This is my code. Whenever I try to check the link, it ends up returning an error message. What can I do to fix this?
window.addEventListener('load', ()=>{
let lon;
let lat;
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(position => {
lon = position.coords.longitude;
lat = position.coords.latitude;
const api = `https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid=432199bc4e2df182e56f173156ed4922
`;
});
}else{
h1.textContent = "NOT WORKING"
}
});